package com.zmn.oms.model.mongo.graborder;

import com.alibaba.fastjson.annotation.JSONField;
import com.zmn.oms.manager.utils.MongodbConsts;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexType;
import org.springframework.data.mongodb.core.index.GeoSpatialIndexed;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 类描述：抢单
 *
 * @author liuying
 * @date 2021/07/13 11:02
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = MongodbConsts.OMS_GRAB_ORDER)
public class GrabOrder implements Serializable {

    @MongoId
    private Long id;

    /**
     * 订单Id
     */
    private Long orderId;

    /**
     * 工单Id
     */
    @Indexed
    private Long workId;

    /**
     * 师傅ID
     */
    @Indexed
    private Integer masterId;

    /**
     * 业务类型
     */
    @Indexed
    private Integer bizType;

    /**
     * 派单路径
     *
     * @see com.zmn.oms.common.constant.OrderDistributeConsts#DISTRIBUTE_WAY_PLAT
     */
    @Indexed
    private Integer distributeWay;

    /**
     * 直营(1)/非直营(2)
     */
    @Indexed
    private Integer agent;

    /**
     * 抢单状态 1：待抢单  2：已抢
     */
    @Indexed
    private Integer grabStatus;

    /**
     * 城市
     */
    @Indexed
    private Integer cityId;

    /**
     * 城市名称
     */
    private String cityName;

    /**
     * 区ID
     */
    @Indexed
    private Integer countyId;

    /**
     * 区域名称
     */
    private String countyName;

    /**
     * 街道id
     */
    @Indexed
    private Integer streetId;

    /**
     * 街道
     */
    private String street;

    /**
     * 网格ID
     */
    @Indexed
    private Integer gridId;

    /**
     * 服务商id
     */
    @Indexed
    private Integer manageCompanyId;

    /**
     * 行政子公司id
     */
    @Indexed
    private Integer gridCompanyId;

    /**
     * 地理位置
     */
    @GeoSpatialIndexed(type = GeoSpatialIndexType.GEO_2DSPHERE)
    private Double[] location;

    /**
     * 服务分类id
     */
    @Indexed
    private Integer servCategId;

    /**
     * 产品二级分类
     */
    @Indexed
    private Integer categId;

    /**
     * 产品信息
     */
    private String productInfo;

    /**
     * 版本号，用于修改订单
     */
    private Long version;

    /**
     * 预约时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Indexed
    private Date dutyTime;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Indexed
    private Date createTime;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @Indexed
    private Date grabEndTime;

}
